package com.kuaiyin.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(name = "UserDTO", description = "用户数据传输对象")
public class UserDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "用户ID（更新时必填，创建时无需填）")
    private Long id;

    @Schema(description = "登录账号（唯一）")
    @NotBlank(message = "用户名不能为空")
    private String username;

    @Schema(description = "密码（创建时必填，更新时可选）")
    @Size(min = 6, message = "密码长度至少6位")
    private String password;

    @Schema(description = "所属部门ID")
    @NotNull(message = "部门ID不能为空")
    private Integer departmentId;

    @Schema(description = "手机号（唯一）")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误")
    private String phone;

    @Schema(description = "邮箱（唯一）")
    @Email(message = "邮箱格式错误")
    private String email;

    @Schema(description = "状态：0-禁用 1-启用")
    private Integer status;
}